home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / printing / ljetmgr2.4-b / ljetmgr2 / SW / lib / libtixVTree4.0.4.tsl < prev    next >
Text File  |  1996-06-13  |  3KB  |  61 lines

  1. # RQ tixScrolledHList 4
  2. # +END
  3. Require tixScrolledHList 4
  4. tixWidgetClass tixVTree {-classname TixVTree
  5. -superclass tixScrolledHList
  6. -method {}
  7. -flag {-ignoreinvoke}
  8. -configspec {{-ignoreinvoke ignoreInvoke IgnoreInvoke false tixVerifyBoolean}}
  9. -default {}}
  10. proc tixVTree::InitWidgetRec {w} {upvar #0 $w data
  11. tixChainMethod $w InitWidgetRec}
  12. proc tixVTree::ConstructWidget {w} {upvar #0 $w data
  13. tixChainMethod $w ConstructWidget
  14. set data(indStyle) [tixDisplayStyle image -refwindow $data(w:hlist) -padx 0 -pady 0]}
  15. proc tixVTree::SetBindings {w} {upvar #0 $w data
  16. tixChainMethod $w SetBindings
  17. $data(w:hlist) config -indicatorcmd "tixVTree::IndicatorCmd $w" -browsecmd "tixVTree::BrowseCmdHook $w" -command "tixVTree::CommandHook $w"}
  18. proc tixVTree::IndicatorCmd {w args} {upvar #0 $w data
  19. set event [tixEvent type]
  20. set ent   [tixEvent flag V]
  21. set type [tixVTree::GetType $w $ent]
  22. set plus     [LocateImage pixmap plus] 
  23. set plusarm     [LocateImage pixmap plusarm] 
  24. set minus     [LocateImage pixmap minus] 
  25. set minusarm [LocateImage pixmap minusarm] 
  26. case $event {<Arm> {if {$type == "open"} {$data(w:hlist) indicator config $ent -image $plusarm} else {$data(w:hlist) indicator config $ent -image $minusarm}}
  27. <Disarm> {if {$type == "open"} {$data(w:hlist) indicator config $ent -image $plus} else {$data(w:hlist) indicator config $ent -image $minus}}
  28. <Activate> {tixCallMethod $w Activate $ent $type}}}
  29. proc tixVTree::GetType {w ent} {upvar #0 $w data
  30. set img [$data(w:hlist) indicator cget $ent -image]
  31. if {$img == [LocateImage pixmap plus]} {return open}
  32. if {$img == [LocateImage pixmap plusarm]} {return open}
  33. return close}
  34. proc tixVTree::Activate {w ent type} {upvar #0 $w data
  35. set plus     [LocateImage pixmap plus] 
  36. set minus     [LocateImage pixmap minus] 
  37. if {$type == "open"} {tixCallMethod $w OpenCmd $ent
  38. $data(w:hlist) indicator config $ent -image $minus} else {tixCallMethod $w CloseCmd $ent
  39. $data(w:hlist) indicator config $ent -image $plus}}
  40. proc tixVTree::CommandHook {w args} {upvar #0 $w data
  41. upvar bind bind
  42. tixCallMethod $w Command bind}
  43. proc tixVTree::BrowseCmdHook {w args} {upvar #0 $w data
  44. upvar bind bind
  45. tixCallMethod $w BrowseCmd bind}
  46. proc tixVTree::SetMode {w ent mode} {upvar #0 $w data
  47. case $mode {open {$data(w:hlist) indicator create $ent -itemtype image -image [LocateImage pixmap plus]}
  48. close {$data(w:hlist) indicator create $ent -itemtype image -image [LocateImage pixmap minus]}
  49. none {if [$data(w:hlist) indicator exist $ent] {$data(w:hlist) indicator delete $ent }}}}
  50. proc tixVTree::OpenCmd {w ent} {upvar #0 $w data
  51. foreach kid [$data(w:hlist) info children $ent] {$data(w:hlist) show entry $kid}}
  52. proc tixVTree::CloseCmd {w ent} {upvar #0 $w data
  53. foreach kid [$data(w:hlist) info children $ent] {$data(w:hlist) hide entry $kid}}
  54. proc tixVTree::Command {w B} {upvar #0 $w data
  55. upvar $B bind
  56. if {$data(-ignoreinvoke)} {return}
  57. set ent $bind(%V)
  58. if [$data(w:hlist) indicator exist $ent] {tixVTree::Activate $w $ent [tixVTree::GetType $w $ent]}}
  59. proc tixVTree::BrowseCmd {w B} {}
  60. # +EOF
  61.